package com.shrct.businessprocess.budget.impl;

import com.shrct.businessprocess.budget.RCCostBreakDown;
import com.shrct.businessprocess.budget.RCEXBaseBudget;
import com.shrct.businessprocess.budget.impl.RCHasCostBudgetImpl;
import com.shrct.businessprocess.budget.proxy.RCEXBaseBudgetProxy;
import com.shrct.businessprocess.project.RCProject;
import com.shrct.businessprocess.project.RCProjectMoney;
import javax.persistence.AssociationOverride;
import javax.persistence.AssociationOverrides;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;

@Entity
@DiscriminatorValue("RCEXBASEBUDGET_TYPE")
public abstract class RCEXBaseBudgetImpl extends RCHasCostBudgetImpl implements RCEXBaseBudget {
  public RCEXBaseBudgetImpl() {
    super();
  }
  
  public RCEXBaseBudgetImpl(final RCCostBreakDown cbd) {
    super( cbd);
    
  }
  
  private String name;
  
  public String getName() {
    return this.name;
  }
  
  public RCEXBaseBudget setName(final String name) {
    this.name = name;
    return this;			
    
  }
  
  @Embedded
  @AttributeOverrides(value = { @AttributeOverride(name = "amount", column = @Column(name = "netPrice_amount") ), @AttributeOverride(name = "workaround", column = @Column(name = "netPrice_workaround") ) } )
  @AssociationOverrides(value = @AssociationOverride(name = "exchange", joinColumns = @JoinColumn(name = "netPrice_exchange") ) )
  private RCProjectMoney netPrice = com.shrct.businessprocess.project.RCProjectMoney.create();
  
  public RCProjectMoney getNetPrice() {
    return this.netPrice;
  }
  
  public RCEXBaseBudget setNetPrice(final RCProjectMoney netPrice) {
    this.netPrice = netPrice;
    return this;			
    
  }
  
  private Double netTaxRate = Double.valueOf(0d);
  
  public Double getNetTaxRate() {
    return this.netTaxRate;
  }
  
  public RCEXBaseBudget setNetTaxRate(final Double netTaxRate) {
    this.netTaxRate = netTaxRate;
    return this;			
    
  }
  
  public RCProjectMoney getContractPrice() {
    RCCostBreakDown _cbd = this.getCbd();
    RCProject _project = _cbd.getProject();
    RCProjectMoney _zeroAmount = _project.getZeroAmount();
    return _zeroAmount;
  }
  
  public Double getContractTaxRate() {
    return Double.valueOf(0d);
  }
  
  public String getEntityName() {
    return this.name;
  }
  
  public RCEXBaseBudgetProxy toProxy() {
    com.shrct.businessprocess.budget.proxy.RCEXBaseBudgetProxy proxy = new com.shrct.businessprocess.budget.proxy.RCEXBaseBudgetProxy();
    proxy.setId(this.getId());
    if(this instanceof edu.fudan.mylang.pf.INamedModelObject){
    	proxy.setName(((edu.fudan.mylang.pf.INamedModelObject)this).getEntityName());
    }
    return proxy;
    
  }
}
